<template>
    <div class="add-category">
        <Form :label-width="80">
            <FormItem label="商品分类">
                <Cascader :data="category" v-model="value"></Cascader>
            </FormItem>
        </Form>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                value: [],
                category: []
            }
        },
        methods: {
            getGoodsCategory () {
                const self = this;
                this.$http.getGoodsCategory().then(res => {
                    if(res.success === true) {
                        self.category = res.data
                    }
                }, error => {
                })
            }
        },
        watch:{
            value:function(val){
                this.$emit('change',val);
            }
        },
        created () {
            this.getGoodsCategory();
        }
    }
</script>
